package com.huiquan.foundation.dao;

import com.huiquan.analysis.dao.BaseDao;
import com.huiquan.analysis.domain.User;
import com.huiquan.foundation.domain.TabHelp;
import com.ibatis.sqlmap.client.SqlMapClient;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Repository("tabHelpDao")
public class TabHelpDao extends BaseDao {
	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "TAB_HELP.";

	public TabHelp retrieveBytabId(String tabid) {
		Map<String, Object> params = new HashMap<>();
		params.put("tabid", tabid);

		return (TabHelp) this.object(space + "RETRIEVE_BY_TABID", params, sqlMapClient);
	}

	public void updateRemark(String tabid, String remark, User user) {
		Map<String, Object> param = new HashMap<>();
		param.put("tabid", tabid);
		param.put("remark", remark);
		param.put("userid", user.getUserId());

		this.update(space + "UPDATE", param, sqlMapClient);
	}
	public void insert(String tabid, User user) {
		Map<String, Object> params = new HashMap<>();
		params.put("tabid", tabid);
		params.put("userid", user.getUserId());

		this.insert(space + "INSERT", params, sqlMapClient);
	}
}
